Creating a Curve Shape
TheGXNewShape
function takes one parameter--the type of shape to create--and returns a reference to the new shape. To store this shape reference, you need to declare a shape reference variable, which you can do using this declaration:
gxShape aCurveShape;To create a curve shape, call theGXNewShape
function, using thegxCurveType
constant to specify that you want to create a curve shape:
aCurveShape = GXNewShape(gxCurveType);QuickDraw GX responds to this function call by creating a new shape object, initializing the values of its properties, and returning a reference to it.
After the call to the
- Note
- In this example, when you call the
GXNewShape
function, QuickDraw GX notices that your application doesn't yet have a graphics client heap. Therefore, QuickDraw GX automatically creates one for you. By default, the size of this heap is 600K.![]()
GXNewShape
function, you can use the shape reference stored in youraCurveShape
variable to examine the values stored in the properties of the shape and also to modify the values of those properties.Figure 2-2 shows the properties of a shape object. All shape objects have the same nine properties.
Figure 2-2 A shape object and its properties
The following list describes the purpose of these properties and discusses the initial value of each property as set by QuickDraw GX when creating your curve shape object:
As you can see, that's a lot of results for a single function call! In this example, the call to the
- The shape type property indicates which type of shape the shape object represents. For curves, this is set to the value of the
gxCurveType
constant.- The geometry property contains the coordinates that define the shape. Curve shapes are defined by three points: a first point, an off-curve point, and a last point. When creating a new curve shape, QuickDraw GX sets all three of these points to the origin: (0.0, 0.0). Therefore, the geometry contains three pairs of coordinates, all set to 0.0: (0.0, 0.0), (0.0, 0.0), (0.0, 0.0).
- The shape fill property indicates how the shape should be filled when drawn. Curve shapes cannot contain an area like rectangles can, therefore, they must have a framed fill rather than a solid fill. When creating a new curve shape, QuickDraw GX sets this property to the value of the
gxFrameFill
constant.- The style property contains a reference to the default style object. Style objects specify stylistic modifications that QuickDraw GX applies when drawing the curve shape.
- The ink property contains a reference to the default ink object. Ink objects specify color-related information that QuickDraw GX uses when drawing the curve shape.
- The transform property contains a reference to the default transform object. Transform objects specify clipping, mapping, and viewing information that QuickDraw GX applies when drawing the curve shape.
- The shape attributes property contains flags that control certain object-related behaviors of the curve object. Initially, all these flags are cleared (set to 0) for curve shapes.
- The owner count property indicates how many references to the shape
object exist. QuickDraw GX sets the initial value of this property to 1--corresponding to the reference to this shape object stored in youraCurveShape
variable.- The tag list property contains a list of references to tag objects, which allow you to attach application-specific information to your curve shape. QuickDraw GX initially creates an empty tag list for your curve shape.
GXNewShape
function